# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time    : 2020/07/10 20:43
# @author  : LanBingWa
# @function: post service of fastapi

from pydantic import BaseModel
from fastapi import FastAPI
import uvicorn


app = FastAPI()


class Item(BaseModel):
    wxid: str
    wxid1: str = None
    msg: str


@app.post('/msg')
def calculate(data: Item):
    wxid = data.wxid
    wxid1 = data.wxid1
    msg = data.msg
    print(wxid, wxid1, msg)
    res = {"res": "OK", "data": data}
    return res


if __name__ == '__main__':
    uvicorn.run(app=app, host="127.0.0.1", port=10000, workers=1)
